/*
 ------------------------------------------------------------------------------
 Copyright (C) 2009-2011 Eternal Games.

 This file is part of the Eternal Tech source code.

 The Eternal Tech source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The Eternal Tech source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the Eternal Tech source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


//
// cl_public.h - Public header file to all other systems
//


#if !defined(__CL_PUBLIC_H__) || !INCLUDE_GUARDS
#define __CL_PUBLIC_H__


/*
 ==============================================================================

    KEYS.CPP

 ==============================================================================
*/

void				CL_SetKeyEditMode (bool editMode);

/*
 ==============================================================================

    CL_CONSOLE.CPP

 ==============================================================================
*/

void				Con_Print (const char *text);

/*
 ==============================================================================

    CL_KEYS.CPP

 ==============================================================================
*/

// In order from highest priority to lowest.
// If none of the catchers are active, bound key strings will be executed.
enum keyCatch_t {
	KEYCATCH_CONSOLE		= BIT(0),
};

// These are the key numbers that should be passed to Key_Event.
// Normal keys should be passed as lowercased ASCII.
enum keyNum_t {
	K_TAB					= 9,
	K_ENTER					= 13,
	K_ESCAPE				= 27,
	K_SPACE					= 32,
	K_BACKSPACE				= 127,

	K_UPARROW,
	K_DOWNARROW,
	K_LEFTARROW,
	K_RIGHTARROW,

	K_INSERT,
	K_DELETE,
	K_HOME,
	K_END,
	K_PAGEUP,
	K_PAGEDOWN,

	K_LALT,
	K_RALT,
	K_LCTRL,
	K_RCTRL,
	K_LSHIFT,
	K_RSHIFT,

	K_LWIN,
	K_RWIN,
	K_MENU,

	K_F1,
	K_F2,
	K_F3,
	K_F4,
	K_F5,
	K_F6,
	K_F7,
	K_F8,
	K_F9,
	K_F10,
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RL_BUTTON27,
	K_CTRL_BUTTON28,
	K_CTRL_BUTTON29,
	K_CTRL_BUTTON30,
	K_CTRL_BUTTON31,
	K_CTRL_BUTTON32,

	MAX_KEYS				= 256
};

void				Key_WriteBindings (fileHandle_t f);

int					Key_GetCatchers ();
void				Key_AddCatchers (int catchers);
void				Key_RemoveCatchers (int catchers);

bool				Key_IsDown (int key);

void				Key_ClearStates ();

void				Key_Event (int key, int time, bool down);
void				Key_CharEvent (int ch);

void				Key_Init ();
void				Key_Shutdown ();

/*
 ==============================================================================

    CL_MAIN.CPP

 ==============================================================================
*/


void				CL_Init ();
void				CL_Shutdown ();


#else
FILE_WARNING
#endif   // __CL_PUBLIC_H__